import request from './axiosApi'
import {ref} from "vue";

// parmas ==> get delete patch
// data   ==> post put

// axiosXxxx(url, data, params)

const Service = {
    //登录
    login: params => request.axiosPost('/login/generalLogin', params),
    accessToken: params => request.axiosPost('/oauth/token', params),
    getUserToken: params => request.axiosGet('/user/getUserToken', params),
    getUserInfo2: params => request.axiosPost("/user/get_info2", params),
    register: params => request.axiosPost("/user/register", params),

//  管理员接口
    getUserList: params => request.axiosGet("/admin/user", params),
    insertUser: p => request.axiosPost("/admin/user", p),
    deleteUser: p => request.axiosDelete('admin/user', p),
    updateUser: p => request.axiosPut('/admin/user', p),
    getUserStatus: p => request.axiosGet('/admin/status', p),

    getTenantList: params => request.axiosGet("/admin/tenant", params),
    insertTenant: p => request.axiosPost("/admin/tenant", p),
    updateTenant: p => request.axiosPut('/admin/tenant', p),

    getAppList: params => request.axiosGet("/admin/appClient", params),
    insertApp: p => request.axiosPost("/admin/appClient", p),
    updateApp: p => request.axiosPut('/admin/appClient', p),
    getSecret: p => request.axiosGet('/admin/getSecret', p),

    addTenantUser: p => request.axiosPost('/admin/addTenantUser', p),
    addAppUser: p => request.axiosPost('/admin/addAppUser', p),
    getUserRelationList: p => request.axiosGet(`/admin/${p.id}/${p.type}`, ''),

    userUpdate: p => request.axiosPut("/user/update", p),
    getVerCode: p => request.axiosGet("/verification/mobile/getCode", p),
    forgetPwd: p => request.axiosPost("/user/forgetPwd", p)

}

export default Service
